﻿/*main.js*/

$(document).ready(function(){
	//$("#content").hide();
	doCheck();
	
	$("#index_view_school").click(function(){
		 $.ajax({
			url: "Admin/Api/school.php",
			type: 'get',
			dataType: "html",
			success: function(data){
				$("#content").html(data);
			},
			error: function(XMLHttpRequest, textStatus, errorThrown) 
			{  
				alert(XMLHttpRequest.status);  
				alert(XMLHttpRequest.readyState);  
				alert(textStatus);   
			},
		});
		
	});
	
	$("#index_login").click(function(){
		 $.ajax({
			url: "Api/login.php",
			type: 'get',
			dataType: "html",
			success: function(data){
				$("#content").html(data);
			},
			error: function(XMLHttpRequest, textStatus, errorThrown) 
			{  
				alert(XMLHttpRequest.status);  
				alert(XMLHttpRequest.readyState);  
				alert(textStatus);   
			},
		});
		
	});
	
	$("#index_logout").click(function(){
		 $.ajax({
			url: "Admin/Api/school.php",
			type: 'get',
			dataType: "html",
			success: function(data){
				$("#content").html(data);
			},
			error: function(XMLHttpRequest, textStatus, errorThrown) 
			{  
				alert(XMLHttpRequest.status);  
				alert(XMLHttpRequest.readyState);  
				alert(textStatus);   
			},
		});
		
	});
	
	$("#index_sign").click(function(){
		 $.ajax({
			url: "Api/check.php",
			type: 'get',
			dataType: "html",
			success: function(data){
				$("#content").html(data);
			},
			error: function(XMLHttpRequest, textStatus, errorThrown) 
			{  
				alert(XMLHttpRequest.status);  
				alert(XMLHttpRequest.readyState);  
				alert(textStatus);   
			},
		});
		
	});
	
	$("#index_count").click(function(){
		 $.ajax({
			url: "Admin/Api/count.php",
			type: 'get',
			dataType: "html",
			success: function(data){
				$("#content").html(data);
			},
			error: function(XMLHttpRequest, textStatus, errorThrown) 
			{  
				alert(XMLHttpRequest.status);  
				alert(XMLHttpRequest.readyState);  
				alert(textStatus);   
			},
		});
		
	});
	
	$("#index_view_news").click(function(){
		 $.ajax({
			url: "Api/check.php",
			type: 'get',
			dataType: "html",
			success: function(data){
				$("#content").html(data);
			},
			error: function(XMLHttpRequest, textStatus, errorThrown) 
			{  
				alert(XMLHttpRequest.status);  
				alert(XMLHttpRequest.readyState);  
				alert(textStatus);   
			},
		});
		
	});
	
	
	$(".left_menu_li").mouseover(function(){
		$(this).parent().css({
		//"border":"1px solid #1f1f1f",
		"background-color":"rgba(0,0,0,0.3)"
		});
	});
	
	$(".left_menu_li").mouseleave(function(){
		$(this).parent().css({
			//"border":"none",
			"background":"none"
		});
	});
	
});

function doCheck(){
 $.ajax({
			url: "Admin/Api/count.php",
			type: 'get',
			dataType: "html",
			success: function(data){
				$("#content").html(data);
			},
			error: function(XMLHttpRequest, textStatus, errorThrown) 
			{  
				alert(XMLHttpRequest.status);  
				alert(XMLHttpRequest.readyState);  
				alert(textStatus);   
			},
		});
}

function tree(data){
	if( $(data).parent().children("ul").css("display") == 'none' ){  
		$(data).parent().children("ul").css("display","block");
		$(data).parent().children(".index_span_more").html(" - ");
	}else{
		$(data).parent().children("ul").css("display","none");
		$(data).parent().children(".index_span_more").html("+");
	}
}
